using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using UniversalAdmin.Domain.Common;

namespace UniversalAdmin.Domain.Entities;

[Table("files")]
public class File : AggregateRoot
{
  [Required]
  [MaxLength(255)]
  [Column("name")]
  public string Name { get; set; } = null!;

  [Required]
  [MaxLength(255)]
  [Column("original_name")]
  public string OriginalName { get; set; } = null!;

  [Required]
  [MaxLength(500)]
  [Column("path")]
  public string Path { get; set; } = null!;

  [Column("size")]
  public long Size { get; set; }

  [MaxLength(100)]
  [Column("mime_type")]
  public string? MimeType { get; set; }

  [Column("user_id")]
  public int? UserId { get; set; }

  [ForeignKey("UserId")]
  public virtual User? User { get; set; }
}